-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix implicit_getter false positive #5300
Fix implicit_getter false positive #5300
Conversation
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks!
Please also add an entry to the CHANGELOG to credit yourself and let others know about the fix.
Source/SwiftLintBuiltInRules/Rules/Style/ImplicitGetterRuleExamples.swift
Show resolved
Hide resolved
Source/SwiftLintBuiltInRules/Rules/Style/ImplicitGetterRule.swift
Outdated
Show resolved
Hide resolved
You need to remove the |
@SimplyDanny do you know what Danger is complaining about? |
It doesn't like merge commits. Please rebase and force-push instead. |
4b25fbe
to
9f9ebc1
Compare
@SimplyDanny looks like we're green! |
The
implicit_getter
rule wasn't aware of theinit
accessor (SE-0400), causing it to incorrectly trigger on the following exampleRather than adding a check for
initAccessor
I updated the check to bail early unlessaccessorsList
has a single element, that beingget
. This allows for forwards-compatibility if another accessor variant were to be introduced in the future. Semantically, IIUC this rule should only trigger in the aforementioned case that there's one accessor and that accessor isget
— otherwise it isn't possible to elide the keyword.